package com.sohoo.nio.mima.codec;

import java.net.SocketAddress;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;

public class DemoEnCoder implements ProtocolEncoder {

	public void encode(IoSession session, Object message,
			ProtocolEncoderOutput out) throws Exception {
		byte[] bytes = new byte[] {03, 00,01,00,01};
		SocketAddress localAddress = session.getLocalAddress();
		String string = "Hello Are you OK?"+localAddress;
		IoBuffer ioBuffer = IoBuffer.wrap(bytes);
		out.write(ioBuffer);
	}

	public void dispose(IoSession session) throws Exception {
		
	}

}
